//柯里化案例
// ''.match(/\s+/g)
// ''.match(/\d+/g)

const _ = require('lodash')

// function match (reg, str) {
//   return str.match(reg)
// }

const match = _.curry(function (reg, str) {
  return str.match(reg)
}) 

const havaSpace = match(/\s+/g)
const havaNumber = match(/\d+/g)

// console.log(havaSpace('helloword'))
// console.log(havaNumber('helloword'))

const filter = _.curry(function(func, array){
  return array.filter(func)
})

console.log(filter(havaSpace, ['abc ccc', 'ddd_rrrr']))

const findSpace = filter(havaSpace)
console.log(findSpace(['abc ccc', 'ddd_rrrr']))